With the 'hitmob' attribute you can set a script file that is called when you hit a mob. You can use world, player and living for your script, where living is the player/monster you are hit.
hitmob="loader.loadScript('xyz.script');";